package com.dingding.study.Event.serviceImpl;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/** 
* @author  Zhenhua Sun E-mail: sunzhh@dazhuanjia.com
* @date createTime：2017年6月27日 下午4:16:47 
* @version 1.0  
*/
public class DomainEventListenerAutoSubscribleProcessor implements BeanPostProcessor {
    public Object postProcessAfterInitialization(Object bean, String beanName)
           throws BeansException {
       if(bean instanceof DomainEventListener){
    	   DomainEventPublisher.getInstance().subscrible((DomainEventListener<?>) bean);
       }
       return bean;
    }
	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		return bean;
	}
}